<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="author" content="rinodung" />
    <link rel="stylesheet" type="text/css" href="<?php echo static_url(); ?>/css/admin/common.css" />    
    <link rel="stylesheet" type="text/css" href="<?php echo static_url(); ?>/css/admin/giaovien_tructuyen.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo static_url(); ?>/css/menu/menu_css.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo static_url(); ?>/css/popup/popup_css.css" />
    <script type="text/javascript" src="<?php echo static_url(); ?>/js/jquery.min.js"></script>
	<script type="text/javascript">
		var lops = new Array();
		<?php
			$i = 0;
			foreach($lops as $lop)
			{
				echo "var temp = new Array();";
				echo "temp[0] = ".$lop['GioBD'].";";
				echo "temp[1] = ".$lop['PhutBD'].";";
				echo "temp[2] = ".$lop['GioKT'].";";
				echo "temp[3] = ".$lop['PhutKT'].";";
				echo "lops[".$i."] = temp;";
				$i++;
			}
		?>
			
		function kt()
		{
			var n = lops.length;
			for(var i=0; i<n; i++)
			{
				var cur = new Date();
				var BD = new Date();
				var KT = new Date();
				BD.setHours(parseInt(lops[i][0]));
				BD.setMinutes(parseInt(lops[i][1]));
				KT.setHours(parseInt(lops[i][2]));
				KT.setMinutes(parseInt(lops[i][3]));
				BD.setTime(BD.getTime() - 15*60000);
				KT.setTime(KT.getTime() + 15*60000);
				if(cur.getTime() >= BD.getTime() && cur.getTime() <= KT.getTime())
				{
					$("#lop"+i).show();
				}
				else
				{
					$("#lop"+i).hide();
				}
			}
		}
		
		$(document).ready(function()
		{			
			$("button.btnlop").click(function()
			{
				var malop = $(this).attr("malop");
				var phong = $(this).attr("phong"); 
				$("#phong").val(phong);
				$("#malop").val(malop);
				$("form#lop").submit();
			});
			//kt();
			//setInterval(kt, 10000);
		});
	</script>
    
    <script type="text/javascript" src="<?php echo static_url(); ?>/js/admin/jgiaovien_tructuyen.js"></script>        
	<title><?php echo $title ?></title>
</head>

<body>
<div id="wrapper">
    <div id="header">
    <img src="<?php echo static_url(); ?>/images/logo.png" alt="logo.gif" id="logo" />     
    <img src="<?php echo static_url(); ?>/images/header_pic.png" alt="header_" id="header_pic" />
     <p>Trường Đại Học Công Nghệ Thông Tin<br />
       Trường Đại Học Quốc Gia Thành Phố Hồ Chí Minh<br />
       Hệ Thống Đăng Ký Học Phần
    </p>
    </div><!--#header -->
    <div id="page">
    
    <!--div #main_menu -->    
    <?php include_once("vmenu.php"); ?>
    <!--END div #main_menu --> 
       
    <div id="data">
            
            <div id="tool">
                <p id="data_title">&#187;&#187;Các lớp dạy hôm nay</p>
                <img id="mail" title="Gửi thời khóa biểu giảng dạy cho giáo viên" src="<?php echo static_url(); ?>/images/mail.png" alt="mail" />
                <img id="export" title="Xuất thời khóa biểu thành file(Excel,PDF)" src="<?php echo static_url(); ?>/images/export.png" alt="export" />
                <img id="print" title="In thời khóa biểu này(PDF)" src="<?php echo static_url(); ?>/images/print.png" alt="print" />
            </div><!--end #tool -->
            
            <div id="content">
					<table>
						<?php 							
						$i = 0;
						foreach ($lops as $malop=>$lop)
						{
							echo "<tr><td><button id='lop".$i."' class='btnlop' malop='".$malop."' phong='".$lop['Phong']."'>Vào lớp</button></td><td>".$lop['Phong']."</tr>";
							$i++;
						}
						
						?>
					</table>
					<form id="lop" method="POST" action="<?php echo base_url(); ?>room/gv" >
						<input type='hidden' name="phong" id="phong" />
						<input type='hidden' name="malop" id="malop" />
					</form>
            </div><!--end #content -->
            
    </div><!--end #data -->
    </div><!--#page -->
</div><!--end #wrapper -->

</body>
</html>